import { axios } from '@/utils/request'

// 商品列表
export const getProductList = (params) => {
  return axios({
    url: '/products',
    method: 'get',
    params
  })
}

// 商品详情
export const getProductDetails = (id) => {
  return axios({
    url: `/products/${id}`,
    method: 'get'
  })
}

// 新建商品
export const createProduct = (data) => {
  return axios({
    url: '/products',
    method: 'post',
    data
  })
}

// 更新商品
export const updateProduct = (id, data) => {
  return axios({
    url: `/products/${id}`,
    method: 'put',
    data
  })
}